<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>在线评测系统 - 登录</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
            background-color: #f5f7fa;
            min-height: 100vh;
            position: relative;
            overflow: hidden;
        }
        
        .background-image {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: linear-gradient(-45deg, #0b0b3b, #3a1c71, #4c43cd, #0575e6);
            background-size: 400% 400%;
            animation: gradientBg 15s ease infinite;
            z-index: -2;
        }
        
        @keyframes gradientBg {
            0% {
                background-position: 0% 50%;
            }
            50% {
                background-position: 100% 50%;
            }
            100% {
                background-position: 0% 50%;
            }
        }
        
        .background-overlay {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: -1;
            overflow: hidden;
        }
        
        .squares {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            overflow: hidden;
            z-index: -1;
        }
        
        .square {
            position: absolute;
            display: block;
            list-style: none;
            background: rgba(255, 255, 255, 0.1);
            animation: animate 25s linear infinite;
            bottom: -150px;
            box-shadow: 0 0 10px rgba(255, 255, 255, 0.05);
            backdrop-filter: blur(5px);
        }
        
        .square:nth-child(1) {
            left: 25%;
            width: 80px;
            height: 80px;
            animation-delay: 0s;
        }
        
        .square:nth-child(2) {
            left: 10%;
            width: 20px;
            height: 20px;
            animation-delay: 2s;
            animation-duration: 12s;
        }
        
        .square:nth-child(3) {
            left: 70%;
            width: 20px;
            height: 20px;
            animation-delay: 4s;
        }
        
        .square:nth-child(4) {
            left: 40%;
            width: 60px;
            height: 60px;
            animation-delay: 0s;
            animation-duration: 18s;
        }
        
        .square:nth-child(5) {
            left: 65%;
            width: 20px;
            height: 20px;
            animation-delay: 0s;
        }
        
        .square:nth-child(6) {
            left: 75%;
            width: 110px;
            height: 110px;
            animation-delay: 3s;
        }
        
        .square:nth-child(7) {
            left: 35%;
            width: 150px;
            height: 150px;
            animation-delay: 7s;
        }
        
        .square:nth-child(8) {
            left: 50%;
            width: 25px;
            height: 25px;
            animation-delay: 15s;
            animation-duration: 45s;
        }
        
        .square:nth-child(9) {
            left: 20%;
            width: 15px;
            height: 15px;
            animation-delay: 2s;
            animation-duration: 35s;
        }
        
        .square:nth-child(10) {
            left: 85%;
            width: 150px;
            height: 150px;
            animation-delay: 0s;
            animation-duration: 11s;
        }
        
        @keyframes animate {
            0% {
                transform: translateY(0) rotate(0deg);
                opacity: 1;
                border-radius: 30%;
            }
            100% {
                transform: translateY(-1000px) rotate(720deg);
                opacity: 0;
                border-radius: 50%;
            }
        }

        .header {
            position: absolute;
            top: 30px;
            left: 50px;
            z-index: 10;
        }
        
        .logo-container {
            display: flex;
            align-items: center;
        }
        
        .logo-image {
            height: 50px;
            margin-right: 15px;
        }
        
        .logo-text {
            color: #fff;
            font-size: 24px;
            font-weight: bold;
            text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
        }
        
        .slogan {
            position: absolute;
            top: 50%;
            left: 10%;
            transform: translateY(-50%);
            color: #fff;
            z-index: 5;
            text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
        }
        
        .slogan h1 {
            font-size: 36px;
            font-weight: 300;
            margin-bottom: 20px;
            letter-spacing: 2px;
        }
        
        .slogan p {
            font-size: 18px;
            font-weight: 300;
            max-width: 500px;
            line-height: 1.6;
            opacity: 0.9;
        }

        .login-container {
            position: absolute;
            top: 50%;
            right: 10%;
            transform: translateY(-50%);
            background: rgba(31, 35, 41, 0.7);
            backdrop-filter: blur(15px);
            padding: 40px;
            border-radius: 12px;
            width: 400px;
            box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
            z-index: 10;
            color: #fff;
            border: 1px solid rgba(255, 255, 255, 0.1);
            overflow: hidden;
        }
        
        .login-container::before {
            content: '';
            position: absolute;
            top: -50%;
            left: -50%;
            width: 200%;
            height: 200%;
            background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.03), transparent);
            transform: rotate(45deg);
            animation: shine 6s linear infinite;
            pointer-events: none;
        }
        
        @keyframes shine {
            0% {
                top: -150%;
                left: -50%;
            }
            100% {
                top: 150%;
                left: 150%;
            }
        }

        .login-header {
            display: flex;
            justify-content: space-between;
            margin-bottom: 30px;
            align-items: center;
        }
        
        .login-title {
            font-size: 20px;
            font-weight: 500;
        }
        
        .login-tabs {
            display: flex;
        }
        
        .login-tab {
            padding: 0 15px;
            color: rgba(255, 255, 255, 0.7);
            cursor: pointer;
            position: relative;
            transition: all 0.3s ease;
        }
        
        .login-tab.active {
            color: #fff;
            font-weight: 500;
        }
        
        .login-tab.active::after {
            content: '';
            position: absolute;
            bottom: -5px;
            left: 50%;
            transform: translateX(-50%);
            width: 20px;
            height: 2px;
            background-color: #1e88e5;
            border-radius: 2px;
        }
        
        .tab-content {
            display: none;
        }
        
        .tab-content.active {
            display: block;
        }

        .form-group {
            margin-bottom: 25px;
            position: relative;
        }

        .form-group i {
            position: absolute;
            left: 12px;
            top: 50%;
            transform: translateY(-50%);
            color: rgba(255, 255, 255, 0.7);
            font-size: 18px;
            transition: all 0.3s ease;
        }

        .form-group input {
            width: 100%;
            padding: 12px 12px 12px 40px;
            border: 1px solid rgba(255, 255, 255, 0.2);
            border-radius: 4px;
            font-size: 14px;
            transition: all 0.3s ease;
            background-color: rgba(255, 255, 255, 0.1);
            color: #fff;
        }

        .form-group input::placeholder {
            color: rgba(255, 255, 255, 0.5);
        }

        .form-group input:focus {
            outline: none;
            border-color: #1e88e5;
            background-color: rgba(255, 255, 255, 0.15);
        }
        
        .form-group input:focus + i {
            color: #1e88e5;
        }

        .captcha-group {
            display: flex;
            gap: 15px;
            align-items: center;
        }

        .captcha-group input {
            flex: 1;
        }

        .captcha-image {
            width: 120px;
            height: 40px;
            background: rgba(255, 255, 255, 0.2);
            border-radius: 4px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-family: 'Courier New', Courier, monospace;
            font-size: 18px;
            font-weight: bold;
            letter-spacing: 2px;
            color: #fff;
            user-select: none;
            position: relative;
            overflow: hidden;
            transition: all 0.3s ease;
        }
        
        .captcha-image:hover {
            background: rgba(255, 255, 255, 0.25);
        }

        .options-row {
            display: flex;
            justify-content: space-between;
            margin-bottom: 25px;
            font-size: 14px;
        }
        
        .remember-me {
            display: flex;
            align-items: center;
            color: rgba(255, 255, 255, 0.7);
        }
        
        .remember-me input {
            margin-right: 5px;
        }
        
        .forgot-password {
            color: rgba(255, 255, 255, 0.7);
            text-decoration: none;
            transition: all 0.3s ease;
        }
        
        .forgot-password:hover {
            color: #1e88e5;
        }

        .login-btn {
            width: 100%;
            padding: 12px;
            background: #1e88e5;
            color: white;
            border: none;
            border-radius: 4px;
            font-size: 16px;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .login-btn:hover {
            background: #1976d2;
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(30, 136, 229, 0.4);
        }


        
        .footer {
            position: absolute;
            bottom: 20px;
            left: 0;
            width: 100%;
            text-align: center;
            color: rgba(255, 255, 255, 0.6);
            font-size: 12px;
            z-index: 10;
        }
        
        @media (max-width: 1200px) {
            .slogan {
                display: none;
            }
            
            .login-container {
                right: 50%;
                transform: translate(50%, -50%);
            }
        }
    </style>
</head>
<body>
    <div class="background-image"></div>
    <div class="background-overlay">
        <div class="squares">
            <div class="square"></div>
            <div class="square"></div>
            <div class="square"></div>
            <div class="square"></div>
            <div class="square"></div>
            <div class="square"></div>
            <div class="square"></div>
            <div class="square"></div>
            <div class="square"></div>
            <div class="square"></div>
        </div>
    </div>
    
    <div class="header">
        <div class="logo-container">
            <img src="" alt="Logo" class="logo-image">
            <div class="logo-text">在线评测系统</div>
        </div>
    </div>
    
    <div class="slogan">
        <h1>欢迎使用在线评测系统</h1>
        <p>高效、便捷的在线评测平台，助力您的项目评审和管理</p>
    </div>
    
    <div class="login-container">
        <div class="login-header">
            <div class="login-title">登录系统</div>
            <div class="login-tabs">
                <div class="login-tab active" id="accountTab">账号登录</div>
            </div>
        </div>
        
        <div class="tab-content active" id="accountContent">
            <form id="loginForm" onsubmit="return false;">
                <div class="form-group">
                    <input type="text" id="username" placeholder="请输入账号" required>
                    <i class="fas fa-user"></i>
                </div>
                <div class="form-group">
                    <input type="password" id="password" placeholder="请输入密码" required>
                    <i class="fas fa-lock"></i>
                </div>
                <div class="form-group">
                    <div class="captcha-group">
                        <input type="text" id="captcha" placeholder="验证码" required maxlength="4">
                        <div class="captcha-image" id="captchaImage" onclick="refreshCaptcha()"></div>
                    </div>
                </div>
                
                <div class="options-row">
                    <label class="remember-me">
                        <input type="checkbox" id="rememberMe">
                        记住密码
                    </label>
                    <a href="password/forgot-password.html" class="forgot-password">忘记密码?</a>
                </div>
                
                <button class="login-btn" onclick="handleLogin()">登录</button>
            </form>
        </div>
        

    </div>
    
    <div class="footer">
        <p>Copyright © 版权所有 2025年</p>
    </div>

    <script>
        let currentCaptcha = '';
        

        
        function generateCaptcha() {
            const chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
            let captcha = '';
            for (let i = 0; i < 4; i++) {
                captcha += chars[Math.floor(Math.random() * chars.length)];
            }
            return captcha;
        }

        function refreshCaptcha() {
            const captchaImage = document.getElementById('captchaImage');
            currentCaptcha = generateCaptcha();
            
            // 清空之前的内容
            captchaImage.innerHTML = '';
            
            // 设置验证码文本
            text = currentCaptcha;
            
            text.split('').forEach(char => {
                const span = document.createElement('span');
                span.textContent = char;
                span.style.display = 'inline-block';
                span.style.transform = `rotate(${Math.random() * 15 - 7.5}deg)`;
                span.style.margin = '0 2px';
                span.style.color = '#fff';
                span.style.textShadow = '0 1px 2px rgba(0,0,0,0.2)';
                captchaImage.appendChild(span);
            });
            
            // 添加干扰线
            for (let i = 0; i < 3; i++) {
                const line = document.createElement('div');
                line.style.position = 'absolute';
                line.style.width = '100%';
                line.style.height = '1px';
                line.style.background = 'rgba(255, 255, 255, 0.5)';
                line.style.top = `${Math.random() * 100}%`;
                line.style.transform = `rotate(${Math.random() * 180 - 90}deg)`;
                captchaImage.appendChild(line);
            }
        }

        function handleLogin() {
            const username = document.getElementById('username').value;
            const password = document.getElementById('password').value;
            const captcha = document.getElementById('captcha').value.toUpperCase();

            if (!username || !password || !captcha) {
                alert('请填写完整信息');
                return;
            }

            if (captcha !== currentCaptcha) {
                alert('验证码错误，请重新输入');
                refreshCaptcha();
                document.getElementById('captcha').value = '';
                return;
            }

            // 这里添加登录请求逻辑
            fetch('/api/login', {
                method: 'POST',
                headers: {
                    'Content-Type': 'application/json'
                },
                body: JSON.stringify({
                    username,
                    password,
                    captcha
                })
            })
            .then(response => response.json())
            .then(data => {
                if (data.success) {
                    window.location.href = '/dashboard';
                } else {
                    alert(data.message || '登录失败，请重试');
                    refreshCaptcha();
                }
            })
            .catch(error => {
                console.error('登录错误:', error);
                alert('登录失败，请重试');
                refreshCaptcha();
            });
        }

        // 页面加载完成后生成验证码
        document.addEventListener('DOMContentLoaded', refreshCaptcha);
    </script>
</body>
</html>
